package com.imti.mall.product.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.imti.mall.model.pms.pojo.PmsProductLadder;
import com.imti.mall.product.mapper.PmsProductLadderDynaSqlProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.UpdateProvider;

import java.util.List;

@Mapper
public interface PmsProductLadderDao extends BaseMapper<PmsProductLadder> {


    /**
     * 根据商品id查询商品梯价优惠
     * @param id
     * @return
     */
    @Select("select id,product_id,`count`,discount,price from pms_product_ladder where product_id=#{id}")
    public List<PmsProductLadder> getPmsProductLadderProductId(Integer id);

    /**
     * 根据梯价表id修改梯价表
     * @param pmsProductLadder
     * @return
     */
    @UpdateProvider(type= PmsProductLadderDynaSqlProvider.class,method = "updatePmsProductLadder")
    public Integer updatePmsProductLadder(PmsProductLadder pmsProductLadder);
}